﻿@using DevExpress.Blazor
@using DevExpress.ExpressApp.Blazor.Components
@using EasyXaf.LowCode.WorkflowEditors.Models.Activities
@using Microsoft.AspNetCore.Components.Web

<div class="annotation-activity-component"
     style="@ComponentStyle"
     @ondblclick="BeginEditAnnotation"
     @ondblclick:stopPropagation="true">
    <div class="node-description">
        @if (AnnotationEditing)
        {
            <DxMemo @ref="AnnotationMemo"
                    @bind-Text="AnnotationValue"
                    @onfocusout="EndEditAnnotationAsync"
                    @onkeydown="ProcessKeyDown"
                    @ondblclick:stopPropagation="true"
                    CssClass="w-100"
                    Rows="6"
                    SizeMode="SizeMode.Small"
                    BindValueMode="BindValueMode.OnLostFocus" />
        }
        <span class="annotation-content @(AnnotationEditing?"d-none":"")" @ref="AnnotationEleReference" />
    </div>
    @if (!AnnotationEditing)
    {
        <div class="action hidden-action activity-right-bottom-toolbar">
            @if (!IsReadOnly)
            {
                <NodeAction Tooltip="更多..."
                            IconName="Action_More"
                            IconColor="#7F8C8D"
                            Click="ShowAnnotationMenu" />
            }
        </div>
    }
</div>
